package com.gurumades.jsonform.server.forms.dispatch;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.gurumades.jsonform.server.forms.dispatch.handlers.GetFormHandler;
import com.gurumades.jsonform.server.forms.dispatch.handlers.GetUploadUrlHandler;
import com.gurumades.jsonform.server.forms.dispatch.handlers.SubmitFormHandler;

public class JSONFormActionHandlersConfig implements ServletContextListener{
	public void contextInitialized(ServletContextEvent evt ) {
	    DispatchUtil.setContext(evt.getServletContext());
	    DispatchUtil.registerProvider(new XMLResourceFormProvider());
	    
	    DispatchUtil.registerHandler(new GetFormHandler());
	    DispatchUtil.registerHandler(new SubmitFormHandler());
	    DispatchUtil.registerPreProcessor(new CorePreprocessor());
	    
	    DispatchUtil.registerHandler(new GetUploadUrlHandler());
	  }

	  public void contextDestroyed( ServletContextEvent evt ) {
	    // Do nothing...
	  }
}
